<?php

use think\migration\Migrator;
use think\migration\db\Column;

class CreateClassifyTable extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function up()
    {
        $table = $this->table('classify',array('engine'=>'MyISAM',"comment"=>"分类表"));
        $table->addColumn('ico_image', 'string',array('limit' => 100,'default'=>'','comment'=>'分类图标路径'))
            ->addColumn('name', 'string',array('limit' => 32,'default'=>"",'comment'=>'分类名称'))
            ->addColumn('url', 'string',array('limit' =>50,'default'=>"",'comment'=>'跳转路径'))
            ->addColumn('desc', 'string',array('limit' => 255,'default'=>0,'comment'=>'分类描述'))
            ->addColumn('is_delete', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'删除状态，1已删除'))
            ->create();
    }
    public  function down(){
        $this->dropDatabase("classify");
    }
}
